package cn.com.yxw.webapp.service.impl;

import cn.com.yxw.webapp.dao.AdminMapper;
import cn.com.yxw.webapp.pojo.Admin;
import cn.com.yxw.webapp.pojo.AdminExample;
import cn.com.yxw.webapp.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by xiaowei328 on 2015/5/15.
 */
@Service
public class AdminServiceImpl implements AdminService {


    @Autowired
    private AdminMapper adminMapper;


    public Admin selectAdminByUserName(String userName) {
        Admin admin = null;
        AdminExample example = new AdminExample();
        example.createCriteria().andUsernameEqualTo(userName);
        List<Admin> list = adminMapper.selectByExample(example);
        if (list.size() > 0)
            admin = list.iterator().next();
        return admin;

    }


	public Admin findByUsername(String userName) {
		return adminMapper.selectByUsername(userName);
	}

}
